/*
 * @Autor: zengy
 * @Date: 2021-03-11 17:00:56
 * @LastEditors: zengy
 * @LastEditTime: 2021-10-12 15:32:41
 * @Description:
 * @FilePath: \3DViewer\src\main.js
 */
import { createApp } from 'vue';
import App from './App.vue';
import router from '@/router';
import store from '@/store';
import '@p/flexible';
import 'element-plus/dist/index.css'
import element from '@p/element';
import axios from '@p/axios';
import WS from '@p/socket';
import api from '@/api/interface';
import ECharts from '@p/echarts';
import px from '@utils/globallDefinition';
import wpf from '@utils/wpf';
import component from '@c/component';
import 'echarts-liquidfill';
import '@a/css/reset.css';
import '@a/css/index.less';
import '@a/iconfont/iconfont.css';

const app = createApp(App);
app.use(element)
app.use(axios);
app.use(router);
app.use(store);
app.use(px);
app.use(ECharts);
app.use(wpf);
app.use(component);
app.use(api);

const ws = new WS([], ({ command, params, response }) => {
    if (response && response.code === 0) {
        store.state.wsEventBus.$emit(command, { params, data: response.data });
    }
}, () => {
    !app._container && app.mount('#app');
});
store.commit('setWebSocket', ws);
